//
//  Statuses.swift
//  WeiBo
//
//  Created by 陈贵 on 15/9/11.
//  Copyright © 2015年 hzj. All rights reserved.
//

import UIKit

class Statuses: NSObject {
    
    /// 创建时间
    var created_at: String?
    /// 微博ID
    var id: Int = 0
    /// 微博信息内容
    var text: String?
    /// 微博来源
    var source: String?
    
    /// 用户user
    var user :User?
    
    /// 转发微博
    var retweeted_status :Statuses?
    
    /// 图片
    var pic_urls:[[String:String]]?

    
    //字典转模型
    init(dict:[String:AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
        
    }
    /// 执行setValuesForKeysWithDictionary 时会调用此方法
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user" {
            user = User(dict: value as! [String:AnyObject])
            return
        }
        
        if key == "retweeted_status"{
            
            retweeted_status = Statuses(dict: value as! [String:AnyObject])
            
            return
        }
        super.setValue(value, forKey: key)
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    override var description:String{
        let key = ["created_at","id","text","source","user","pic_urls","retweeted_status"]
        return dictionaryWithValuesForKeys(key).description
    }
    

}
